home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form frmMain
- Caption = "MIME Multithreaded Demonstration"
- ClientHeight = 6405
- ClientLeft = 1635
- ClientTop = 810
- ClientWidth = 7095
- ControlBox = 0 'False
- Height = 6810
- Left = 1575
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 6405
- ScaleWidth = 7095
- Top = 465
- Width = 7215
- Begin VB.TextBox txtOutputPath
- BackColor = &H00C0C0C0&
- Height = 285
- Left = 1680
- Locked = -1 'True
- TabIndex = 37
- TabStop = 0 'False
- Top = 5400
- Width = 4815
- End
- Begin VB.CheckBox Finished
- Height = 255
- Index = 9
- Left = 6600
- TabIndex = 34
- TabStop = 0 'False
- Top = 4560
- Width = 255
- End
- Begin VB.CheckBox Finished
- Height = 255
- Index = 8
- Left = 6600
- TabIndex = 33
- TabStop = 0 'False
- Top = 4200
- Width = 255
- End
- Begin VB.CheckBox Finished
- Height = 255
- Index = 7
- Left = 6600
- TabIndex = 32
- TabStop = 0 'False
- Top = 3840
- Width = 255
- End
- Begin VB.CheckBox Finished
- Height = 255
- Index = 6
- Left = 6600
- TabIndex = 31
- TabStop = 0 'False
- Top = 3480
- Width = 255
- End
- Begin VB.CheckBox Finished
- Height = 255
- Index = 5
- Left = 6600
- TabIndex = 30
- TabStop = 0 'False
- Top = 3120
- Width = 255
- End
- Begin VB.CheckBox Finished
- Height = 255
- Index = 4
- Left = 6600
- TabIndex = 29
- TabStop = 0 'False
- Top = 2760
- Width = 255
- End
- Begin VB.CheckBox Finished
- Height = 255
- Index = 3
- Left = 6600
- TabIndex = 28
- TabStop = 0 'False
- Top = 2400
- Width = 255
- End
- Begin VB.CheckBox Finished
- Height = 255
- Index = 2
- Left = 6600
- TabIndex = 27
- TabStop = 0 'False
- Top = 2040
- Width = 255
- End
- Begin VB.CheckBox Finished
- Height = 255
- Index = 1
- Left = 6600
- TabIndex = 26
- TabStop = 0 'False
- Top = 1680
- Width = 255
- End
- Begin VB.CheckBox Finished
- Height = 255
- Index = 0
- Left = 6600
- TabIndex = 25
- TabStop = 0 'False
- Top = 1320
- Width = 255
- End
- Begin VB.CommandButton cmdQuit
- Caption = "Quit"
- Height = 375
- Left = 5040
- TabIndex = 2
- Top = 5880
- Width = 1455
- End
- Begin VB.CommandButton cmdStart
- Caption = "Start"
- Height = 375
- Left = 3480
- TabIndex = 1
- Top = 5880
- Width = 1455
- End
- Begin VB.TextBox txtSourceFilename
- BackColor = &H00C0C0C0&
- ForeColor = &H00000000&
- Height = 285
- Left = 1680
- Locked = -1 'True
- TabIndex = 0
- TabStop = 0 'False
- Text = "Click the ""Start"" button to be prompted for a source filename."
- Top = 5040
- Width = 4815
- End
- Begin VB.TextBox Text
- BackColor = &H00C0C0C0&
- ForeColor = &H00000000&
- Height = 285
- Index = 9
- Left = 240
- Locked = -1 'True
- TabIndex = 22
- TabStop = 0 'False
- Top = 4560
- Width = 2895
- End
- Begin VB.TextBox Text
- BackColor = &H00C0C0C0&
- ForeColor = &H00000000&
- Height = 285
- Index = 8
- Left = 240
- Locked = -1 'True
- TabIndex = 21
- TabStop = 0 'False
- Top = 4200
- Width = 2895
- End
- Begin VB.TextBox Text
- BackColor = &H00C0C0C0&
- ForeColor = &H00000000&
- Height = 285
- Index = 7
- Left = 240
- Locked = -1 'True
- TabIndex = 20
- TabStop = 0 'False
- Top = 3840
- Width = 2895
- End
- Begin VB.TextBox Text
- BackColor = &H00C0C0C0&
- ForeColor = &H00000000&
- Height = 285
- Index = 6
- Left = 240
- Locked = -1 'True
- TabIndex = 19
- TabStop = 0 'False
- Top = 3480
- Width = 2895
- End
- Begin VB.TextBox Text
- BackColor = &H00C0C0C0&
- ForeColor = &H00000000&
- Height = 285
- Index = 5
- Left = 240
- Locked = -1 'True
- TabIndex = 18
- TabStop = 0 'False
- Top = 3120
- Width = 2895
- End
- Begin VB.TextBox Text
- BackColor = &H00C0C0C0&
- ForeColor = &H00000000&
- Height = 285
- Index = 4
- Left = 240
- Locked = -1 'True
- TabIndex = 17
- TabStop = 0 'False
- Top = 2760
- Width = 2895
- End
- Begin VB.TextBox Text
- BackColor = &H00C0C0C0&
- ForeColor = &H00000000&
- Height = 285
- Index = 3
- Left = 240
- Locked = -1 'True
- TabIndex = 16
- TabStop = 0 'False
- Top = 2400
- Width = 2895
- End
- Begin VB.TextBox Text
- BackColor = &H00C0C0C0&
- ForeColor = &H00000000&
- Height = 285
- Index = 2
- Left = 240
- Locked = -1 'True
- TabIndex = 15
- TabStop = 0 'False
- Top = 2040
- Width = 2895
- End
- Begin VB.TextBox Text
- BackColor = &H00C0C0C0&
- ForeColor = &H00000000&
- Height = 285
- Index = 1
- Left = 240
- Locked = -1 'True
- TabIndex = 14
- TabStop = 0 'False
- Top = 1680
- Width = 2895
- End
- Begin VB.TextBox Text
- BackColor = &H00C0C0C0&
- ForeColor = &H00000000&
- Height = 285
- Index = 0
- Left = 240
- Locked = -1 'True
- TabIndex = 13
- TabStop = 0 'False
- Top = 1320
- Width = 2895
- End
- Begin VB.Label lblOutputPath
- Alignment = 1 'Right Justify
- Caption = "Output Path:"
- Height = 255
- Left = 240
- TabIndex = 38
- Top = 5400
- Width = 1335
- End
- Begin VB.Label lblEncodingProgress
- Caption = "Encoding Progress:"
- Height = 255
- Left = 3240
- TabIndex = 36
- Top = 1080
- Width = 1575
- End
- Begin VB.Label lblEncodedFilename
- Caption = "Encoded Filename:"
- Height = 255
- Left = 240
- TabIndex = 35
- Top = 1080
- Width = 1575
- End
- Begin VB.Line TopLine
- BorderColor = &H00000000&
- BorderWidth = 3
- X1 = 240
- X2 = 6840
- Y1 = 120
- Y2 = 120
- End
- Begin VB.Label lblInfo
- Caption = $"frmMain.frx":0000
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 9.75
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- ForeColor = &H00000000&
- Height = 735
- Left = 240
- TabIndex = 24
- Top = 240
- Width = 6255
- End
- Begin VB.Label lblSourceFilename
- Alignment = 1 'Right Justify
- Caption = "Source Filename:"
- Height = 255
- Left = 240
- TabIndex = 23
- Top = 5040
- Width = 1335
- End
- Begin ComctlLib.ProgressBar ProgressBar
- Height = 255
- Index = 9
- Left = 3240
- TabIndex = 12
- Top = 4560
- Width = 3255
- _Version = 65536
- _ExtentX = 5741
- _ExtentY = 450
- _StockProps = 192
- Appearance = 1
- End
- Begin ComctlLib.ProgressBar ProgressBar
- Height = 255
- Index = 8
- Left = 3240
- TabIndex = 11
- Top = 4200
- Width = 3255
- _Version = 65536
- _ExtentX = 5741
- _ExtentY = 450
- _StockProps = 192
- Appearance = 1
- End
- Begin ComctlLib.ProgressBar ProgressBar
- Height = 255
- Index = 7
- Left = 3240
- TabIndex = 10
- Top = 3840
- Width = 3255
- _Version = 65536
- _ExtentX = 5741
- _ExtentY = 450
- _StockProps = 192
- Appearance = 1
- End
- Begin ComctlLib.ProgressBar ProgressBar
- Height = 255
- Index = 6
- Left = 3240
- TabIndex = 9
- Top = 3480
- Width = 3255
- _Version = 65536
- _ExtentX = 5741
- _ExtentY = 450
- _StockProps = 192
- Appearance = 1
- End
- Begin ComctlLib.ProgressBar ProgressBar
- Height = 255
- Index = 5
- Left = 3240
- TabIndex = 8
- Top = 3120
- Width = 3255
- _Version = 65536
- _ExtentX = 5741
- _ExtentY = 450
- _StockProps = 192
- Appearance = 1
- End
- Begin ComctlLib.ProgressBar ProgressBar
- Height = 255
- Index = 4
- Left = 3240
- TabIndex = 7
- Top = 2760
- Width = 3255
- _Version = 65536
- _ExtentX = 5741
- _ExtentY = 450
- _StockProps = 192
- Appearance = 1
- End
- Begin ComctlLib.ProgressBar ProgressBar
- Height = 255
- Index = 3
- Left = 3240
- TabIndex = 6
- Top = 2400
- Width = 3255
- _Version = 65536
- _ExtentX = 5741
- _ExtentY = 450
- _StockProps = 192
- Appearance = 1
- End
- Begin ComctlLib.ProgressBar ProgressBar
- Height = 255
- Index = 2
- Left = 3240
- TabIndex = 5
- Top = 2040
- Width = 3255
- _Version = 65536
- _ExtentX = 5741
- _ExtentY = 450
- _StockProps = 192
- Appearance = 1
- End
- Begin ComctlLib.ProgressBar ProgressBar
- Height = 255
- Index = 1
- Left = 3240
- TabIndex = 4
- Top = 1680
- Width = 3255
- _Version = 65536
- _ExtentX = 5741
- _ExtentY = 450
- _StockProps = 192
- Appearance = 1
- End
- Begin ComctlLib.ProgressBar ProgressBar
- Height = 255
- Index = 0
- Left = 3240
- TabIndex = 3
- Top = 1320
- Width = 3255
- _Version = 65536
- _ExtentX = 5741
- _ExtentY = 450
- _StockProps = 192
- Appearance = 1
- End
- Begin CIMIMELib.CIMIME CIMIME
- Height = 450
- Index = 9
- Left = 5880
- Top = 120
- Width = 480
- _Version = 65537
- _ExtentX = 847
- _ExtentY = 794
- _StockProps = 0
- SourceFilename = ""
- DestinationFilename= ""
- End
- Begin CIMIMELib.CIMIME CIMIME
- Height = 450
- Index = 8
- Left = 5280
- Top = 120
- Width = 480
- _Version = 65537
- _ExtentX = 847
- _ExtentY = 794
- _StockProps = 0
- SourceFilename = ""
- DestinationFilename= ""
- End
- Begin CIMIMELib.CIMIME CIMIME
- Height = 450
- Index = 7
- Left = 4680
- Top = 120
- Width = 480
- _Version = 65537
- _ExtentX = 847
- _ExtentY = 794
- _StockProps = 0
- SourceFilename = ""
- DestinationFilename= ""
- End
- Begin CIMIMELib.CIMIME CIMIME
- Height = 450
- Index = 6
- Left = 4080
- Top = 120
- Width = 480
- _Version = 65537
- _ExtentX = 847
- _ExtentY = 794
- _StockProps = 0
- SourceFilename = ""
- DestinationFilename= ""
- End
- Begin CIMIMELib.CIMIME CIMIME
- Height = 450
- Index = 5
- Left = 3480
- Top = 120
- Width = 480
- _Version = 65537
- _ExtentX = 847
- _ExtentY = 794
- _StockProps = 0
- SourceFilename = ""
- DestinationFilename= ""
- End
- Begin CIMIMELib.CIMIME CIMIME
- Height = 450
- Index = 4
- Left = 2880
- Top = 120
- Width = 480
- _Version = 65537
- _ExtentX = 847
- _ExtentY = 794
- _StockProps = 0
- SourceFilename = ""
- DestinationFilename= ""
- End
- Begin CIMIMELib.CIMIME CIMIME
- Height = 450
- Index = 3
- Left = 2280
- Top = 120
- Width = 480
- _Version = 65537
- _ExtentX = 847
- _ExtentY = 794
- _StockProps = 0
- SourceFilename = ""
- DestinationFilename= ""
- End
- Begin CIMIMELib.CIMIME CIMIME
- Height = 450
- Index = 2
- Left = 1680
- Top = 120
- Width = 480
- _Version = 65537
- _ExtentX = 847
- _ExtentY = 794
- _StockProps = 0
- SourceFilename = ""
- DestinationFilename= ""
- End
- Begin CIMIMELib.CIMIME CIMIME
- Height = 450
- Index = 1
- Left = 1080
- Top = 120
- Width = 480
- _Version = 65537
- _ExtentX = 847
- _ExtentY = 794
- _StockProps = 0
- SourceFilename = ""
- DestinationFilename= ""
- End
- Begin CIMIMELib.CIMIME CIMIME
- Height = 450
- Index = 0
- Left = 480
- Top = 120
- Width = 480
- _Version = 65537
- _ExtentX = 847
- _ExtentY = 794
- _StockProps = 0
- SourceFilename = ""
- DestinationFilename= ""
- End
- Attribute VB_Name = "frmMain"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Dim iFileCount As Integer
- Private Sub CIMIME_Encoded(Index As Integer, ByVal BytesRead As Long, ByVal BytesWritten As Long, ByVal LinesEncoded As Long)
- ' Update progress bar
- ProgressBar(Index).Value = BytesRead
- End Sub
- Private Sub CIMIME_EncodingFinished(Index As Integer, ByVal Error As Integer)
- ' Increment the file count
- iFileCount = iFileCount + 1
- ' Check the finished box
- Finished(Index).Value = 1
- ' All files are encoded so enable buttons
- If iFileCount = 10 Then
- iFileCount = 0
- DoEvents
- MsgBox ("Encoding has finished")
- txtSourceFilename.Text = ""
- cmdStart.Enabled = True
- cmdQuit.Enabled = True
- End If
- End Sub
- Private Sub CIMIME_EncodingStarted(Index As Integer)
- If Index = 0 Then
- ' - Use the same source filename for all encodes
- txtSourceFilename.Text = CIMIME(0).SourceFilename
-
- ' - Initiate the next 9 MIME encodes using a single source file
- For iThreadCount% = 1 To 9
- Text(iThreadCount%).Text = "OUTPUT" & CStr(iThreadCount%) + 1 & ".m"
- CIMIME(iThreadCount%).FireStatus = True
- CIMIME(iThreadCount%).ProgressDialogVisible = False
- CIMIME(iThreadCount%).SourceFilename = txtSourceFilename.Text
- CIMIME(iThreadCount%).DestinationFilename = txtOutputPath.Text & "\" & "OUTPUT.0" & _
- CStr(iThreadCount%) + 1 & ".m"
- ' MIMEEncode initiates the encoding operation
- ' which causes the EncodingStarted event to
- ' fire. When the encoding operation completes,
- ' the EncodingFinished event fires. If you set
- ' the FireStatus property to True, the Encoded
- ' event fires during the decoding operation
- ' (depending on the file size).
- CIMIME(iThreadCount%).MIMEEncode
- Next
- End If
- ' - Initialize progress bar to the source file size
- ProgressBar(Index).Max = CIMIME(Index).SourceFileSize
- End Sub
- Private Sub cmdQuit_Click()
- End
- End Sub
- Private Sub cmdStart_Click()
- ' Make sure boxes are not checked
- For iThreadCount% = 0 To 9
- Finished(iThreadCount%).Value = 0
- Next
- ' Disable command buttons
- cmdStart.Enabled = False
- cmdQuit.Enabled = False
- Text(0).Text = "OUTPUT" & CStr(iThreadCount%) + 1 & ".m"
- CIMIME(0).FireStatus = True
- CIMIME(0).ProgressDialogVisible = False
- CIMIME(0).DestinationFilename = txtOutputPath.Text & "\" & "OUTPUT.0" & _
- CStr(0) + 1 & ".m"
- ' MIMEEncode initiates the encoding operation
- ' which causes the EncodingStarted event to
- ' fire. When the encoding operation completes,
- ' the EncodingFinished event fires. If you set
- ' the FireStatus property to True, the Encoded
- ' event fires during the decoding operation
- ' (depending on the file size).
- bResult = CIMIME(0).MIMEEncode
- ' - Something went wrong so restore idle state
- If bResult = False Then
- iFileCount = 0
- DoEvents
- cmdStart.Enabled = True
- cmdQuit.Enabled = True
- Exit Sub
- End If
- End Sub
- Private Sub Form_Load()
- '---------------------------------------------------------------------
- ' Title: MIME Multithreaded Demo
- ' Description: This program illustrates the multithreaded
- ' capabilities of the CIMIME control. CIMIME or
- ' CIUU enable you to easily encode or decode
- ' data in the background.
- ' Author: Stephen Casella
- ' Last Revision: May 2, 1996
- '---------------------------------------------------------------------
- ' center main form
- frmMain.Top = Screen.Height \ 2 - frmMain.Height \ 2
- frmMain.Left = Screen.Width \ 2 - frmMain.Width \ 2
- ' Output path
- txtOutputPath.Text = App.Path
- ' Initialize variable
- iFileCount = 0
- End Sub
-